package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {
    /**
     * 根据菜品id查询套餐id
     * @param dishIds
     * @return
     */
    //select setmeal id from setmeal dish where dish_id in(1,2,3,4)
    List<Long> getSetmealIdsByDishIds(List<Long> dishIds);

    /**
     * 根据id删除category相同的菜品
     * @param ids
     */
    void deleteByDishIds(List<Long> ids);

    /**
     * 根据id删除套餐
     * @param id
     */
    @Delete("delete from setmeal_dish where id = #{id}")
    void deleteById(Long id);

    /**
     * 修改套餐菜品关联
     * @param newDish
     */
    void insertBatch(List<SetmealDish> newDish);

    /**
     * 修改菜品回显
     * @param id
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id =#{setmealId}")
    List<SetmealDish> getSetmealByDishId(Long id);
}
